package me.liuyu2783.dubbo.sample.dubbo;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

/**
 * me.liuyu2783.dubbo.sample.dubbo
 *
 * @author liuyu2783
 * @date 2020-3-3
 */
public class RemoteRegister {

    public static ConcurrentHashMap<String, List<URL>> registMap = new ConcurrentHashMap();

    public static void regist(String interfaceName, URL url){
        List list = getUrlList(interfaceName);
        if(list.size() == 0){
            list = new ArrayList();
        }
        list.add(url);
        registMap.put(interfaceName, list);
    }

    public static  List<URL> getUrlList(String interfaceName){
        List list = registMap.get(interfaceName);
        return list;
    }
}
